const request = require('../../utils/request.js')
Page({
  data: {
    price: ''
  },
  onLoad() {
    setInterval(() => {
      this.loadData()
    }, 1000)
  },
  loadData() {
    wx.showNavigationBarLoading()
    wx.request({
      url: 'https://www.okex.me/api/v1/ticker.do?symbol=btc_usdt',
      header: {
        'Content-type': 'application/json'
      },
      method: 'GET',
      success: (res) => {
        wx.hideNavigationBarLoading()
        console.log(res.data.ticker.last)
        const price = res.data.ticker.last
        this.setData({
          price: price
        })
      }
    })

  }
})